package st.lib.base.service;

import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.support.annotation.Nullable;

/**
 * @author zhangyu
 * @date 2018/9/20
 * 日志服务
 */

public class ZyService extends Service {
    //方法调用log
    public static final int MSG_METHOD_LOG = 1;
    final Messenger mMessenger = new Messenger(new InComingHandler());

    @SuppressLint("HandlerLeak")
    class InComingHandler extends Handler {
        @Override
        public void handleMessage(Message msg) {
            int what = msg.what;
            switch (what) {
                case MSG_METHOD_LOG:
                    Bundle bundle = msg.getData();
                    break;
                default:
                    super.handleMessage(msg);

            }
        }
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return mMessenger.getBinder();
    }

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }
}
